#include <iostream>
#include <vector>
#include <string>
#include <math.h>

using namespace std;

int findNthDigit(int n) {
    long num = n;
    int len = 1;
    long base = 10;
    while (len * base < num) {
        num += base;
        base *= 10;
        len++;
    }
    return to_string(num / len)[num % len] - '0';
}

int main(){
    int n = 16;
    cout << findNthDigit(n) << endl;
    return 0;
}
